package test;

import common.Utils;
import org.openqa.selenium.By;

public class LoginPage extends Utils {
    public static String url = "http://127.0.0.1:9580/sign-in.html";
    public LoginPage() {
        super(url);
    }

    //异常登录
    public void AbnormalLogin(){
        driver.findElement(By.cssSelector("#username")).sendKeys("洪哲");
        driver.findElement(By.cssSelector("#password")).sendKeys("1234");
        driver.findElement(By.cssSelector("#submit")).click();

        driver.findElement(By.cssSelector("body > div.jq-toast-wrap.bottom-right > div"));
    }

    //正常登录
    public void login() throws InterruptedException {
        driver.findElement(By.cssSelector("#username")).clear();
        driver.findElement(By.cssSelector("#password")).clear();
        driver.findElement(By.cssSelector("#username")).sendKeys("洪哲");
        driver.findElement(By.cssSelector("#password")).sendKeys("123");
        driver.findElement(By.cssSelector("#submit")).click();

        String title =  driver.getTitle();
        assert title.equals("比特论坛");


    }
}
